<?php
class InfoModel extends CommonModel {
	public function _list_($map = '' ,$page = 1,$limit = 16, $orderby = ' indx desc,id desc'){
        $list['count'] = $this->where($map)->count('id');
        $list['page'] = $page;
        $list['map'] = $map;
        $list['limit'] = $limit;
        $pagecount = ceil($list['count'] / $list['limit']);
        if ($pagecount < 1) $pagecount =1;
        $list['pagecount'] = $pagecount;
        $volist = $this->where($map)->page($page,$limit)->order("$orderby ")->select();
        $vlist = array();
        $InfoType = M('InfoType');
        foreach($volist as $v){
            $v['url_text'] = '外网连接';
            if (!$v['url']) {
                $v['url_text'] = '';
                $v['url'] = U("Mobile/Index/Info?id=$v[id]",'',true,false,true);
            }
            $type = $InfoType->find($v['tid']);
            $v['tid_text'] = $type['title'];
            $vlist[] = $v;
        }
        $list['volist']   =   $vlist;
        return $list;
    }

    function getType($tid = 0){
        $InfoType = M('InfoType');
        $vo = $InfoType->find($tid);
        return $vo;
    }
}